﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System.Text.Json.Serialization;
using YiSha.Enum;
using YiSha.Util;

namespace YiSha.Entity.Business
{
    /// <summary>
    /// 处方表（包含问询）
    /// </summary>
    [Table("BsPrescription")]
    public class PrescriptionEntity : BaseExtensionEntity
    {

        #region 关联档案
        /// <summary>
        /// 真实姓名
        /// </summary>
        [Description("真实姓名")]
        [NotMapped]
        public string RealName { get; set; }


        /// <summary>
        /// 治疗次数
        /// </summary>
        [Description("治疗次数")]
        [NotMapped]
        public int FollowUpSort { get; set; }
        
        /// <summary>
        /// 性别
        /// </summary>
        [Description("性别")]
        [NotMapped]
        public int Gender { get; set; }

        [NotMapped]
        public string GenderText
        {
            get
            {
                if (Gender == 1)
                {
                    return "男";
                }
                else if (Gender == 2)
                {
                    return "女";
                }
                else
                {
                    return "未填写";
                }
            }
        }


        /// <summary>
        /// 生日
        /// </summary>
        [Description("生日")]
        [NotMapped]
        public DateTime Birthday { get; set; }

        [NotMapped]
        public int Age
        {
            get
            {
                return DateTime.Now.Year - Birthday.Year;
            }
        }

        /// <summary>
        /// 身份类别
        /// </summary>
        [Description("身份类别")]
        [NotMapped]
        public EnumOccupation OccupationValue { get; set; }



        /// <summary>
        /// 身份类别
        /// </summary>
        [NotMapped]
        public string OccupationTest
        {
            get
            {
                return OccupationValue.ToString();
            }
        }

        /// <summary>
        /// 手机号
        /// </summary>
        [Description("手机号")]
        [NotMapped]
        public string Mobile { get; set; }


        /// <summary>
        /// 工作单位
        /// </summary>
        [Description("工作单位")]
        [NotMapped]
        public string WorkUnit { get; set; }

        /// <summary>
        /// 家庭住址
        /// </summary>
        [Description("家庭住址")]
        [NotMapped]
        public string Address { get; set; }

        /// <summary>
        /// 所属店铺
        /// </summary>
        [Description("所属店铺")]
        [NotMapped]
        [JsonConverter(typeof(StringJsonConverter))]
        public long DepartmentId { get; set; }

        [NotMapped]
        public string DepartmentName { get; set; }


        [NotMapped]
        public string PersonIdStr
        {
            get
            {
                if (this.PersonId.HasValue)
                {
                    return this.PersonId.Value.ToString();
                }
                else
                {
                    return null;
                }
            }
        }


        #endregion

        /// <summary>
        /// 档案Id
        /// </summary>
        [Description("档案Id")]
        [JsonConverter(typeof(StringJsonConverter))]
        public long? PersonId { get; set; }

        #region 近视

        /// <summary>
        /// 是否近视
        /// </summary>
        [Description("是否近视")]
        public int IsMyopia { get; set; }

        /// <summary>
        /// 近视左眼
        /// </summary>
        [Description("近视左眼")]
        public string MyopiaLefEyeText { get; set; }


        /// <summary>
        /// 近视右眼
        /// </summary>
        [Description("近视右眼")]
        public string MyopiaRightEyeText { get; set; }

        #endregion

        #region 散光

        /// <summary>
        /// 是否散光
        /// </summary>
        [Description("是否散光")]
        public int IsAstigmatism { get; set; }

        /// <summary>
        /// 散光左眼
        /// </summary>
        [Description("散光左眼")]
        public string AstigmatismLefEyeText { get; set; }


        /// <summary>
        /// 散光右眼
        /// </summary>
        [Description("散光右眼")]
        public string AstigmatismRightEyeText { get; set; }

        #endregion

        #region 弱视

        /// <summary>
        /// 是否弱视
        /// </summary>
        [Description("是否弱视")]
        public int IsAmblyopia { get; set; }

        /// <summary>
        /// 弱视左眼
        /// </summary>
        [Description("弱视左眼")]
        public string AmblyopiaLefEyeText { get; set; }


        /// <summary>
        /// 弱视右眼
        /// </summary>
        [Description("弱视右眼")]
        public string AmblyopiaRightEyeText { get; set; }

        #endregion

        #region 干眼症

        /// <summary>
        /// 是否干眼症
        /// </summary>
        [Description("是否干眼症")]
        public int IsXerophthalmia { get; set; }

        /// <summary>
        /// 干眼症治疗史
        /// </summary>
        [Description("干眼症治疗史")]
        public string XerophthalmiaText { get; set; }

        #endregion

        #region 飞蚊症

        /// <summary>
        /// 是否飞蚊症
        /// </summary>
        [Description("是否飞蚊症")]
        public int IsFeiWenZheng { get; set; }

        /// <summary>
        /// 飞蚊症治疗史
        /// </summary>
        [Description("飞蚊症治疗史")]
        public string FeiWenZhengText { get; set; }

        #endregion

        #region 花眼

        /// <summary>
        /// 是否花眼
        /// </summary>
        [Description("是否花眼")]
        public int IsPresbyopia { get; set; }

        /// <summary>
        /// 花眼治疗史
        /// </summary>
        [Description("花眼治疗史")]
        public string PresbyopiaText { get; set; }

        #endregion

        #region 眼部衰老

        /// <summary>
        /// 是否眼部衰老
        /// </summary>
        [Description("是否眼部衰老")]
        public int IsEyeAging { get; set; }

        /// <summary>
        /// 眼部衰老治疗史
        /// </summary>
        [Description("眼部衰老治疗史")]
        public string EyeAgingText { get; set; }

        #endregion

        #region 睡眠情况

        #region 睡眠时间

        /// <summary>
        /// 睡眠时间
        /// </summary>
        [Description("睡眠时间选项")]
        public EnumSleepTime SleepTimeValue { get; set; }

        #endregion

        #region 是否熬夜

        /// <summary>
        /// 是否熬夜
        /// </summary>
        [Description("是否熬夜")]
        public IsEnum IsStayUpLate { get; set; }

        #endregion





        #region 睡眠习惯

        /// <summary>
        /// 睡眠习惯选项
        /// </summary>
        [Description("睡眠习惯选项")]
        public EnumSleepHabits SleepHabitsValue { get; set; }

        #endregion

        #region 睡眠情况

        /// <summary>
        /// 睡眠情况选项
        /// </summary>
        [Description("睡眠情况选项")]
        public EnumSleepQuality SleepQualityValue { get; set; }

        #endregion

        #endregion

        #region 用眼情况

        #region 持续用眼时间 Eye use time

        /// <summary>
        /// 持续用眼时间
        /// </summary>
        [Description("持续用眼时间")]
        public EnumEyeUseTimeValue EyeUseTimeValue { get; set; }

        #endregion

        #region 用眼方式 EyeUseType

        /// <summary>
        /// 用眼方式
        /// </summary>
        [Description("用眼方式")]
        public string EyeUseTypes { get; set; }

        #endregion


        #region 用眼时间段 EyeUsePeriod

        /// <summary>
        /// 用眼时间段
        /// </summary>
        [Description("用眼时间段")]
        public string EyeUsePeriodS { get; set; }

        #endregion


        #region 用眼最长时间 Eye use time Longest

        /// <summary>
        /// 用眼最长时间
        /// </summary>
        [Description("用眼最长时间")]
        public EnumEyeUseTimeLongest EyeUseTimeLongestValue { get; set; }

        #endregion


        #endregion

        #region 基本健康状况

        #region 心、肺、肾、肝疾病

        /// <summary>
        /// 是否心、肺、肾、肝疾病
        /// </summary>
        [Description("是否心、肺、肾、肝疾病")]
        public int IsBHXFSGDisease { get; set; }

        /// <summary>
        /// 心、肺、肾、肝疾病描述
        /// </summary>
        [Description("心、肺、肾、肝疾病描述")]
        public string BHXFSGDiseaseText { get; set; }

        #endregion

        #region 恶性肿瘤、血管瘤病史

        /// <summary>
        /// 是否恶性肿瘤、血管瘤病史
        /// </summary>
        [Description("是否恶性肿瘤、血管瘤病史")]
        public int IsBHZLDisease { get; set; }

        /// <summary>
        /// 恶性肿瘤、血管瘤病史
        /// </summary>
        [Description("心、肺、肾、肝疾病描述")]
        public string BHZLDiseaseText { get; set; }

        #endregion

        #region 体内是否有异物如金属架、硅胶等

        /// <summary>
        /// 体内是否有异物如金属架、硅胶等
        /// </summary>
        [Description("体内是否有异物如金属架、硅胶等")]
        public int IsBHForeignBody { get; set; }

        /// <summary>
        /// 体内是否有异物如金属架、硅胶等描述
        /// </summary>
        [Description("体内是否有异物如金属架、硅胶等描述")]
        public string BHForeignBodyText { get; set; }

        #endregion

        #region 严重器质性心脏病及各种手术恢复期

        /// <summary>
        /// 严重器质性心脏病及各种手术恢复期
        /// </summary>
        [Description("严重器质性心脏病及各种手术恢复期")]
        public int IsBHOperationConvalescence { get; set; }

        /// <summary>
        /// 严重器质性心脏病及各种手术恢复期描述
        /// </summary>
        [Description("严重器质性心脏病及各种手术恢复期描述")]
        public string BHOperationConvalescenceText { get; set; }

        #endregion

        #region 心脏血管疾病及病史者康复期等情况

        /// <summary>
        /// 心脏血管疾病及病史者康复期等情况
        /// </summary>
        [Description("心脏血管疾病及病史者康复期等情况")]
        public int IsBHConvalescence { get; set; }

        /// <summary>
        /// 心脏血管疾病及病史者康复期等情况
        /// </summary>
        [Description("心脏血管疾病及病史者康复期等情况描述")]
        public string BHOConvalescenceText { get; set; }

        #endregion

        #region 脑梗、脑血栓疾病

        /// <summary>
        /// 脑梗、脑血栓疾病
        /// </summary>
        [Description("脑梗、脑血栓疾病")]
        public int IsBHNaoDisease { get; set; }

        /// <summary>
        /// 脑梗、脑血栓疾病描述
        /// </summary>
        [Description("脑梗、脑血栓疾病描述")]
        public string BHNaoDiseaseText { get; set; }

        #endregion

        #region 高血压症

        /// <summary>
        /// 高血压症
        /// </summary>
        [Description("高血压症")]
        public int IsBHHypertension { get; set; }

        /// <summary>
        /// 高血压症描述
        /// </summary>
        [Description("高血压症描述")]
        public string BHHypertensionText { get; set; }

        #endregion

        #region 急性传染病

        /// <summary>
        /// 急性传染病
        /// </summary>
        [Description("急性传染病")]
        public int IsBHInfectiousDisease { get; set; }

        /// <summary>
        /// 急性传染病描述
        /// </summary>
        [Description("急性传染病描述")]
        public string BHInfectiousDiseaseText { get; set; }

        #endregion

        #region 各种出血疾病障碍性贫血

        /// <summary>
        /// 各种出血疾病障碍性贫血
        /// </summary>
        [Description("各种出血疾病障碍性贫血")]
        public int IsBHBloodDisease { get; set; }

        /// <summary>
        /// 急性传染病描述
        /// </summary>
        [Description("各种出血疾病障碍性贫血描述")]
        public string BHBloodDiseaseText { get; set; }

        #endregion

        #region 癫痫病史

        /// <summary>
        /// 癫痫病史
        /// </summary>
        [Description("癫痫病史")]
        public int IsBHEpilepsy { get; set; }

        /// <summary>
        /// 急性传染病描述
        /// </summary>
        [Description("癫痫病史描述")]
        public string BHEpilepsyText { get; set; }

        #endregion

        #region 严重外伤

        /// <summary>
        /// 严重外伤
        /// </summary>
        [Description("严重外伤")]
        public int IsBHtrauma { get; set; }

        /// <summary>
        /// 严重外伤描述
        /// </summary>
        [Description("严重外伤描述")]
        public string BHtraumaText { get; set; }

        #endregion


        #endregion

        #region 是否结束

        /// <summary>
        /// 是否结束
        /// </summary>
        [Description("是否结束")]
        public int IsEnd { get; set; }

        [NotMapped]
        public string EndStatus
        {
            get
            {
                if (IsEnd == 0)
                {
                    return "治疗中";
                }
                else
                {
                    return "已完成";
                }
            }
        }

        /// <summary>
        /// 结束说明
        /// </summary>
        [Description("结束说明")]
        public string EndExplain { get; set; }


        /// <summary>
        /// 结束时间
        /// </summary>
        [Description("结束时间")]
        public DateTime? EndTime { get; set; }

        #endregion 

        /// <summary>
        /// 治疗方案
        /// </summary>
        [Description("治疗方案")]
        public long TreatmentId { get; set; }


        [NotMapped]
        public string TreatmentIdStr
        {
            get
            {
                return this.TreatmentId.ToString();
            }
        }



        [Description("治疗方案内容")]
        [NotMapped]
        public string TreatmentContent { get; set; }



        /// <summary>
        /// 治疗方案特殊说明
        /// </summary>
        [Description("治疗方案特殊说明")]
        public string TreatmentText { get; set; }


        /// <summary>
        /// 费用
        /// </summary>
        [Description("费用")]
        public decimal Fee { get; set; }

    }

    /// <summary>
    /// 睡眠时间
    /// </summary>
    public enum EnumSleepTime
    {
        低于四小时 = 1,
        四到八小时 = 2,
        超过八小时 = 3
    }
    /// <summary>
    /// 睡眠习惯
    /// </summary>
    public enum EnumSleepHabits
    {
        晚12点前 = 1,
        晚12点后 = 2,
    }
    /// <summary>
    /// 睡眠情况选项
    /// </summary>
    public enum EnumSleepQuality
    {
        好 = 1,
        一般 = 2,
        不好 = 3,
        失眠 = 4,
    }

    /// <summary>
    /// 持续用眼时间
    /// </summary>
    public enum EnumEyeUseTimeValue
    {
        二十分钟以上 = 1,
        一小时以上 = 2,
        两小时以上 = 3,
        四小时以上 = 4
    }

    /// <summary>
    /// 持续用眼时间
    /// </summary>
    public enum EnumEyeUseTimeLongest
    {
        两小时以上 = 1,
        四小时以上 = 2,
        八小时以上 = 3
    }
}
